package TeacherEvaluation.com.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import TeacherEvaluation.com.dao.teacherDao;
import TeacherEvaluation.com.entity.Department;
import TeacherEvaluation.com.entity.Teacher;

/**
 * 教师服务类
 * @author 周江燕
 *
 */

@Service
public class teacherService {
	
	@Autowired
	teacherDao teacherDao;
	
	//插入老师
	public int insertTeacher(Teacher teacher) {
		//查看是否存在老师的工号，如果存在返回0，不存在则插入相关老师的信息
		int i = teacherDao.selectTeacherByNumber(teacher.getWork_number());
		if(i>0) {
			return 0;
		}else{
			return teacherDao.insertTeacher(teacher);
		}
	};
	
	//查询所有的老师
	public List<Teacher> selectTeacher(){
		return teacherDao.selTeacher();
	};
	
	//查询
	public Teacher selectTeacherByOne(String work_number){
		return teacherDao.selectTeacherByOne(work_number);
	};
		
	
	//查询所有的院系
	
	
	//修改老师信息
	public int updataTeacher(Teacher teacher) {
		return teacherDao.updataTeacher(teacher);
	};
	
	//删除学生
	public int delTeacher(String work_number) {
		int i = teacherDao.delTeacher(work_number);
		if(i==0) {
			return 0;
		}else {
			return i;
		}
	}
	//修改密码
	public int changePassword(Teacher teacher) {
		return teacherDao.changePassword(teacher);
	}
	//查询未评教老师
	public List<Teacher> seleTS(int te_id){
		return teacherDao.seleTS(te_id);
	}
}
